import { MenuItemDefinition, Types } from '@amcax/base';
import { ctx2 } from '@app-cad/module';
import { ProductTreeNode } from '../../types';

export const show: MenuItemDefinition<ProductTreeNode> = {
  id: 'show',
  children: '显示',
  hidden: ({ props }) =>
    Array.isArray(props) ||
    props?.visible ||
    [
      'assembly-constraint',
      'assembly-constraints-root',
      'measurement-root',
    ].includes(props?.type),
  onClick: async ({ props: node }) => {
    if (![Types.BASIC_PLANE, Types.ORIGIN].includes(node.type as Types)) {
      await ctx2.commandCenters.basicCommands.setVisibility(node.key, true);
    }
  },
};
